package pkg;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class ValidServlet
 */
public class ValidServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ValidServlet() {
        super();
    }

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		try{
			request.login(request.getParameter("username"), request.getParameter("password"));
			System.out.println(request.isUserInRole("user"));
			if(request.isUserInRole("admin")){
				
			}
			if(request.isUserInRole("user")){
				
			}
		}catch(ServletException e){			
			e.printStackTrace();		
		}
		
	}

}
